function getImg() {

	var iptsP4n = document.getElementsByTagName("img");
	for (i = 0; i < iptsP4n.length; i++)

	{

		var slkt = iptsP4n[i];
		var atts = slkt.attributes;
		for (j = 0; j < atts.length; j++) {
			var at = atts[j];
			// if start with
			try {
				if (at.nodeValue)
					if (at.nodeValue.indexOf("captchaImg") == 0)

					{
						 return slkt;
					}
			} catch (e) {
			}
		}

	}

}		

function copyImg(controlId)
	{
	 
				var Url2= getImg();
				alert(Url2.className);
			//	alert(Url2.src);
				controlRange = document.body.createControlRange(); 
			//	alert("a1");
				controlRange.addElement(Url2);
			//	alert("a2");
				controlRange.execCommand('Copy');  
	}

function tryx(func) {
	try {
		func();
	} catch (e) {

		// alert("login.js::" + e.number + ":" + e.message + " " + e.stack);
	}
}

function clickSingle() {

	var iptsP4n = document.getElementsByTagName("a");
	for (i = 0; i < iptsP4n.length; i++)

	{

		var slkt = iptsP4n[i];
		if (slkt.href)
			if (slkt.href.indexOf("http://out.zhe800.com/guang/p/deal/") == 0) {
				// alert(slkt.href);
				slkt.href = "http://out.zhe800.com/guang/p/deal/100040878";
				slkt.click();
				break;

			}

	}

}

// 2、循环删除所有Cookie

// js 遍历所有Cookie

function foreachDelCookie()

{

	var strCookie = document.cookie;

	var arrCookie = strCookie.split("; "); // 将多cookie切割为多个名/值对

	for (var i = 0; i < arrCookie.length; i++)

	{ // 遍历cookie数组，处理每个cookie对

		var arr = arrCookie[i].split("=");

		if (arr.length > 0)

			DelCookie(arr[0]);

	}

}

function GetCooki(offset)

{

	var endstr = document.cookie.indexOf(";", offset);

	if (endstr == -1)

		endstr = document.cookie.length;

	return decodeURIComponent(document.cookie.substring(offset, endstr));

}

function DelCookie(name)

{

	var exp = new Date();

	exp.setTime(exp.getTime() - 1);

	var cval = GetCookie(name);

	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

}
function GetCookie(name)

{

	var arg = name + "=";

	var alen = arg.length;

	var clen = document.cookie.length;

	var i = 0;

	while (i < clen)

	{

		var j = i + alen;

		if (document.cookie.substring(i, j) == arg)

			return GetCooki(j);

		i = document.cookie.indexOf(" ", i) + 1;

		if (i == 0)
			break;

	}

	return null;

}
try {
	// tryx(function() {
	// document.getElementById('username').value = 'attilax10';
	// });
	// tryx(function() {
	// document.getElementById('password').value = '000000';
	//
	// });
//	foreachDelCookie();
//	clickSingle();
	// window.open("http://out.zhe800.com/guang/p/deal/100040878");
	// $("#username").value="aaa";
	// alert($("#username").value);

	// var arrP4a=document.getElementsByName("submit");
	// alert("a10:"+arrP4a);
	// var a1=arrP4a[0];
	// alert("a1:"+a1);
	// var a2=arrP4a.item(0);
	// alert("a2:"+a2);
	
	//alert("now cookie:" + document.cookie);
	// document.cookie="";
	copyImg();
	//alert("clr aft :" + document.cookie);
	window.setTimeout(function() {
		// document.cookie="";
		//alert("bef:"+document.cookie);
		 
	//	alert("aft:"+document.cookie);
	}, 1000);

	// window.setTimeout(function(){
	// alert("start to pub");
	// window.location="http://localhost/destoon/member/my.php?mid=5&action=add&aP4=js";
	// },25000);

} catch (e) {

	alert("login.js::" + e.number + ":" + e.message + "  " + e.stack);
}